﻿<Window   x:Class="SimpleDashboardDataStructureGrid"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" MinWidth="400" MinHeight="200" Width="450" Height="250" 
        xmlns:local="clr-namespace:Vivei.Tools.Modules.Provisionnement" 
        xmlns:system="clr-namespace:System;assembly=mscorlib" 
        xml:lang="fr-FR"
    Title="DataStructureGrid" SizeToContent="WidthAndHeight" ShowInTaskbar="True" WindowStyle="ToolWindow"  >
    <Window.Resources>
        <Style TargetType="ToggleButton" x:Key="ExpansionToggleButton">
            <Setter Property="Template">
                <Setter.Value >
                    <ControlTemplate  TargetType="ToggleButton">
                        <Polygon Name="ToggleButtonPolygon" Fill="Black" RenderTransformOrigin="0.5,0.5" HorizontalAlignment="Left" VerticalAlignment="Center" >
                            <Polygon.Points>
                                <Point X="0" Y="0" />
                                <Point  X="12" Y="6"/>
                                <Point  X="0" Y="12"/>
                            </Polygon.Points>
                        </Polygon>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsChecked" Value="True">
                                <Setter TargetName="ToggleButtonPolygon" Property="RenderTransform">
                                    <Setter.Value>
                                        <RotateTransform Angle="90"/>
                                    </Setter.Value>
                                </Setter>
                            </Trigger>
                            <Trigger Property="IsChecked" Value="False">
                                <Setter TargetName="ToggleButtonPolygon" Property="RenderTransform">
                                    <Setter.Value>
                                        <RotateTransform Angle="0"/>
                                    </Setter.Value>
                                </Setter>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </Window.Resources>
        <Grid Margin="5">
        <!--<DataGrid AutoGenerateColumns="False" 
                  ColumnWidth="*" 
                  Name="DataStructureDataGrid" 
                  CanUserDeleteRows="False" 
                  CanUserAddRows="False"   
                  RowHeight="30"
                  MaxWidth="500">
            
            <DataGrid.RowStyle>
                <Style TargetType="DataGridRow">
                    <Setter Property="Visibility" Value="{Binding Visibility}" />
                </Style>
                
            </DataGrid.RowStyle>
            <DataGrid.Columns>
                <DataGridTemplateColumn Header="Nom Element" >
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <StackPanel Orientation="Horizontal"  Margin="{Binding Indentation}" VerticalAlignment="Center" >
                                <CheckBox Margin="1" IsThreeState="False" IsChecked="{Binding Path=Expanded, Mode=TwoWay}"  />
                                <TextBlock Text="{Binding Name}" Margin="5,0,0,0" VerticalAlignment="Center" />
                            </StackPanel>                           
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                    <DataGridTemplateColumn.CellEditingTemplate>
                        <DataTemplate>
                            <StackPanel Orientation="Horizontal"  Margin="{Binding Indentation}" VerticalAlignment="Center" >
                                <CheckBox Margin="1" IsThreeState="False" IsChecked="{Binding Path=Expanded, Mode=TwoWay}"  />
                                <TextBlock Text="{Binding Name}" Margin="5,0,0,0" VerticalAlignment="Center" />
                            </StackPanel>
                        </DataTemplate>
                    </DataGridTemplateColumn.CellEditingTemplate>
                </DataGridTemplateColumn>
                <DataGridTextColumn Header="Nom Requete"/>
                <DataGridTextColumn Header="Requete"  />
            </DataGrid.Columns>
        </DataGrid>-->

        <ListView Name="DataStructureDataGrid"  MaxWidth="500">
            <ListView.ItemContainerStyle>
                <Style TargetType="ListViewItem">
                    <Setter Property="Visibility" Value="{Binding Visibility}" />
                    <Setter Property="Height" Value="30" />
                </Style>
            </ListView.ItemContainerStyle>
            <ListView.View>
                <GridView AllowsColumnReorder="False">
                    <GridViewColumn Width="150"  Header="Nom Element" >
                        <GridViewColumn.CellTemplate>
                            <DataTemplate>
                                <StackPanel Orientation="Horizontal"  Margin="{Binding Indentation}" VerticalAlignment="Center" >
                                    <ToggleButton Style="{StaticResource ExpansionToggleButton}" Margin="1" IsThreeState="False" IsChecked="{Binding Path=Expanded, Mode=TwoWay}"  />
                                    <TextBlock Text="{Binding Name}" Margin="5,0,0,0" VerticalAlignment="Center" />
                                </StackPanel>
                            </DataTemplate>
                        </GridViewColumn.CellTemplate>
                    </GridViewColumn>
                    <GridViewColumn  Width="150"   Header="Nom Requete" DisplayMemberBinding="{Binding Path=Value, Mode=TwoWay}" />
                    <GridViewColumn  Width="150"   Header="Requete" DisplayMemberBinding="{Binding Path=Value, Mode=TwoWay}"/>
                </GridView>
            </ListView.View>
        </ListView>
    </Grid>
</Window>
